﻿<Window x:Class="Big3.Hitbase.MainControls.MosaicAlbum"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sr="clr-namespace:Big3.Hitbase.SharedResources;assembly=Big3.Hitbase.SharedResources"
        xmlns:local="clr-namespace:Big3.Hitbase.MainControls"
        xmlns:misc="clr-namespace:Big3.Hitbase.Miscellaneous;assembly=Misc"
        x:Name="MosaicAlbumWindow" PreviewKeyDown="MosaicAlbumWindow_PreviewKeyDown"
        Title="MosaicAlbum" Height="300" Width="600" AllowsTransparency="True" Background="Black" WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize" Loaded="Window_Loaded" Unloaded="Window_Unloaded" MouseMove="Window_MouseMove">
    <Window.Resources>
        <misc:NullToVisibilityConverter x:Key="nullToVisibility" />
        
        <Style x:Key="MyProgressBar" TargetType="{x:Type ProgressBar}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ProgressBar}">
                        <Grid MinHeight="14" MinWidth="200">
                            <Border 
                                Name="PART_Track" 
                                CornerRadius="2" 
                                Background="Transparent"
                                BorderBrush="White"
                                BorderThickness="1" />
                            <Border 
                                Name="PART_Indicator" 
                                CornerRadius="2" 
                                Background="White" 
                                BorderBrush="White" 
                                BorderThickness="1" 
                                HorizontalAlignment="Left" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Path x:Key="PlayPath" Data="M 0 0 L 10 10 L 0 20 L 0 0" Fill="White" />
        <Path x:Key="PlayPathHover" Data="M 0 0 L 10 10 L 0 20 L 0 0" Fill="Black" />
        <Path x:Key="PausePath" Data="M 0 0 L 5 0 L 5 20 L 0 20 M 10 0 L 15 0 L 15 20 L 10 20" Fill="White" />
        <Path x:Key="PausePathHover" Data="M 0 0 L 5 0 L 5 20 L 0 20 M 10 0 L 15 0 L 15 20 L 10 20" Fill="Black" />
        <Path x:Key="NextTrackPath" Data="M 0 0 L 10 10 L 0 20 L 0 0 M 10 0 L 15 0 L 15 20 L 10 20" Fill="White" />
        <Path x:Key="NextTrackPathHover" Data="M 0 0 L 10 10 L 0 20 L 0 0 M 10 0 L 15 0 L 15 20 L 10 20" Fill="Black" />
        <Path x:Key="PrevTrackPath" Data="M 0 0 L 5 0 L 5 20 L 0 20 M 15 0 L 15 20 L 5 10" Fill="White" />
        <Path x:Key="PrevTrackPathHover" Data="M 0 0 L 5 0 L 5 20 L 0 20 M 15 0 L 15 20 L 5 10" Fill="Black" />

        <MaterialGroup x:Key="CoverMaterial">
            <DiffuseMaterial>
                <DiffuseMaterial.Brush>
                    <ImageBrush ImageSource="{Binding Playlist.CurrentPlaylistItem.HighQualityTrackImage, ElementName=MosaicAlbumWindow}" />
                </DiffuseMaterial.Brush>
            </DiffuseMaterial>
            <DiffuseMaterial>
                <DiffuseMaterial.Brush>
                    <ImageBrush ImageSource="/Big3.Hitbase.SharedResources;component/Images/glaseffekt-frontglas.png" />
                </DiffuseMaterial.Brush>
            </DiffuseMaterial>
        </MaterialGroup>

        <ControlTemplate x:Key="MyButtonTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Ellipse Name="ButtonEllipse" Stroke="White" Fill="Transparent" Width="40" Height="40">
                </Ellipse>
                <ContentPresenter Name="ButtonContent"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.Setters>
                        <Setter TargetName="ButtonEllipse" Property="Fill" Value="White"></Setter>
                    </Trigger.Setters>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <Style x:Key="PlayerButton" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Ellipse Name="ButtonEllipse" Stroke="White" Fill="Transparent" Width="40" Height="40">
                            </Ellipse>
                            <ContentPresenter Name="ButtonContent"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Trigger.Setters>
                                    <Setter TargetName="ButtonEllipse" Property="Fill" Value="White"></Setter>
                                    <!--<Setter TargetName="ButtonContent" Property="(Content.Path).Fill" Value="Black"></Setter>-->
                                </Trigger.Setters>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid Name="Grid3D" Visibility="Collapsed">
            <Image Stretch="Fill" Source="/Big3.Hitbase.SharedResources;component/Images/disco1.jpg" Opacity="0.9"></Image>
            <Viewport3D Name="ImageWall3D">
                <!--<Viewport3D.Effect>
                    <BlurEffect Radius="3" />
                </Viewport3D.Effect>-->
                <Viewport3D.Camera>
                    <PerspectiveCamera Position="0,0,25" LookDirection="0,0,-1" x:Name="MyCamera" />
                </Viewport3D.Camera>
            </Viewport3D>
            <Image Stretch="Fill" Source="/Big3.Hitbase.SharedResources;component/Images/disco1.jpg" Opacity="0.3"></Image>
            <!--<Image Stretch="Fill" Source="C:\Source\Hitbase 2012\Images\RainBackground.jpg" Opacity="0.4"></Image>-->
        </Grid>
        
        <UniformGrid Rows="10" Columns="16" Name="ThumbnailGrid">
            <UniformGrid.Effect>
                <sr:OldMovie x:Name="OldMoviePixelShader" />
            </UniformGrid.Effect>
            <UniformGrid.RenderTransform>
                <TransformGroup>
                    <ScaleTransform x:Name="ThumbnailGridScaleTransform" />
                </TransformGroup>
            </UniformGrid.RenderTransform>

        </UniformGrid>

        <Grid VerticalAlignment="Center" HorizontalAlignment="Left">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
        <!-- Aktueller Track-->
        <Grid Name="StackPanelCurrentTrack" Opacity="0" Grid.Row="0">
            <Grid>
                <Grid.Effect>
                    <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="20" />
                </Grid.Effect>
                <Grid>
                    <Grid.Effect>
                        <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="20" />
                    </Grid.Effect>
                    
                    <!-- 3D Cover -->
                    <Viewport3D Width="400" Height="400" VerticalAlignment="Center" HorizontalAlignment="Left" Name="ViewPort3D" IsHitTestVisible="false" >
                        <Viewport3D.Camera>
                            <PerspectiveCamera Position="0,0,32" LookDirection="0,0,-1" />
                        </Viewport3D.Camera>
                    </Viewport3D>
                    
                </Grid>
            </Grid>
            <StackPanel Margin="300,50,0,0">
                <StackPanel.Effect>
                    <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
                </StackPanel.Effect>
                <Grid>
                    <Grid.Effect>
                        <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
                    </Grid.Effect>
                    <StackPanel>
                        <TextBlock Text="{Binding Path=Playlist.CurrentPlaylistItem.Info.Artist, ElementName=MosaicAlbumWindow}" FontSize="40" Foreground="White" />
                        <TextBlock Text="{Binding Path=Playlist.CurrentPlaylistItem.Info.Title, ElementName=MosaicAlbumWindow}" FontSize="40" FontWeight="Bold" Foreground="White" />
                        <TextBlock Text="{Binding Path=Playlist.CurrentPlaylistItem.Info.Album, ElementName=MosaicAlbumWindow}" FontSize="40" FontStyle="Italic" Foreground="White" />
                    </StackPanel>
                </Grid>
            </StackPanel>
            <ProgressBar Width="300" Height="20" Margin="50,0,0,20" VerticalAlignment="Bottom" HorizontalAlignment="Left" PreviewMouseLeftButtonDown="ProgressBar_PreviewMouseLeftButtonDown" x:Name="ProgressBar" />
            <TextBlock Width="300" Height="20" Margin="50,0,0,20" VerticalAlignment="Bottom" HorizontalAlignment="Left" Name="TextBlockStatus" IsHitTestVisible="False" TextAlignment="Center" />
            <Button VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="50,0,20,-30" Template="{StaticResource MyButtonTemplate}" Name="PauseButton" Click="PauseButton_Click">
                <Button.Style>
                    <Style>
                        <Setter Property="Button.Content" Value="{StaticResource PausePath}" />
                        <Style.Triggers>
                            <Trigger Property="Button.IsMouseOver" Value="True">
                                <Setter Property="Button.Content" Value="{StaticResource PausePathHover}" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
            <Button VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="50,0,20,-30" Template="{StaticResource MyButtonTemplate}" Name="PlayButton" Click="PlayButton_Click" Visibility="Collapsed">
                <Button.Style>
                    <Style>
                        <Setter Property="Button.Content" Value="{StaticResource PlayPath}" />
                        <Style.Triggers>
                            <Trigger Property="Button.IsMouseOver" Value="True">
                                <Setter Property="Button.Content" Value="{StaticResource PlayPathHover}" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
            <Button VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="100,0,20,-30" Template="{StaticResource MyButtonTemplate}" Name="PrevTrackButton" Click="PrevTrackButton_Click">
                <Button.Style>
                    <Style>
                        <Setter Property="Button.Content" Value="{StaticResource PrevTrackPath}" />
                        <Style.Triggers>
                            <Trigger Property="Button.IsMouseOver" Value="True">
                                <Setter Property="Button.Content" Value="{StaticResource PrevTrackPathHover}" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
            <Button VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="150,0,20,-30" Template="{StaticResource MyButtonTemplate}" Name="NextTrackButton" Click="NextTrackButton_Click">
                <Button.Style>
                    <Style>
                        <Setter Property="Button.Content" Value="{StaticResource NextTrackPath}" />
                        <Style.Triggers>
                            <Trigger Property="Button.IsMouseOver" Value="True">
                                <Setter Property="Button.Content" Value="{StaticResource NextTrackPathHover}" />
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </Grid>
        
        <!-- Nächster Track -->
        <Grid Grid.Row="1" Name="GridNextTrack" Margin="0,100,0,0" Opacity="0" Visibility="{Binding Playlist.NextPlaylistItem, ElementName=MosaicAlbumWindow, Converter={StaticResource nullToVisibility}}">
            <Grid.Effect>
                <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
            </Grid.Effect>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="50,0,0,100">
                <StackPanel.Effect>
                    <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
                </StackPanel.Effect>
                <StackPanel Orientation="Vertical"  >
                    <TextBlock Text="Als nächstes:" FontSize="16" Foreground="White" HorizontalAlignment="Left" Height="30"></TextBlock>
                    <Image Width="100" Height="100" Source="{Binding Playlist.NextPlaylistItem.TrackImage, ElementName=MosaicAlbumWindow}"  VerticalAlignment="Bottom" HorizontalAlignment="Left" />
                </StackPanel>
                <StackPanel Margin="20,30,0,0">
                    <TextBlock Text="{Binding Path=Playlist.NextPlaylistItem.Info.Artist, ElementName=MosaicAlbumWindow}" FontSize="16" Foreground="White" />
                    <TextBlock Text="{Binding Path=Playlist.NextPlaylistItem.Info.Title, ElementName=MosaicAlbumWindow}" FontSize="16" FontWeight="Bold" Foreground="White" />
                    <TextBlock Text="{Binding Path=Playlist.NextPlaylistItem.Info.Album, ElementName=MosaicAlbumWindow}" FontSize="16" FontStyle="Italic" Foreground="White" />
                </StackPanel>
            </StackPanel>
        </Grid>
        </Grid>
        
        <ScrollViewer HorizontalAlignment="Right" Margin="0,50,50,100" Width="500" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled" Name="ScrollViewerLyrics" UseLayoutRounding="False" SnapsToDevicePixels="False">
            <Grid>
                <Grid.Effect>
                    <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
                </Grid.Effect>
                <Grid>
                    <Grid.Effect>
                        <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
                    </Grid.Effect>
                    <TextBlock TextWrapping="Wrap" FontSize="18" Foreground="White" Text="{Binding Path=Playlist.CurrentPlaylistItem.Info.Lyrics, ElementName=MosaicAlbumWindow}"> 
                        <TextBlock.Effect>
                            <DropShadowEffect Color="Black" ShadowDepth="0" BlurRadius="5" />
                        </TextBlock.Effect>
                    </TextBlock>
                </Grid>
            </Grid>
        </ScrollViewer>
        <local:WaveDataUserControl VerticalAlignment="Bottom" Height="150" x:Name="WaveUserCtrl" Opacity="0.5">
            
        </local:WaveDataUserControl>

        <Image Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,10,10,0"
               MouseLeftButtonUp="ImageClose_MouseLeftButtonUp" Name="ImageCloseButton">
            <Image.Style>
                <Style TargetType="{x:Type Image}">
                    <Setter Property="Image.Source" Value="/Big3.Hitbase.SharedResources;component/Images/CloseButton.png" />
                    <Style.Triggers>
                        <Trigger Property="Image.IsMouseOver" Value="True">
                            <Setter Property="Image.Source" Value="/Big3.Hitbase.SharedResources;component/Images/CloseButtonHover.png" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Image.Style>
        </Image>
    </Grid>
</Window>
